using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
namespace HermesPortal.Core
{
    #region ChapterSection
    /// <summary>
    /// This object represents the properties and methods of a ChapterSection.
    /// </summary>
    public class Section
    {
        protected int _id;
        protected int _chapterID;
        protected string _imagePath = String.Empty;
        protected string _body = String.Empty;
        protected int _accessID;
        protected int _viewOrder;
        protected int _creatorID;
        protected DateTime _createdDate;
        protected bool _isPrivate;
        protected DateTime _lastUpated;

        public Section()
        {
        }

        

        internal Section(SqlDataReader reader)
        {
            this.LoadFromReader(reader);
        }

        protected void LoadFromReader(SqlDataReader reader)
        {
            if (reader != null && !reader.IsClosed)
            {
                _id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) _chapterID = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) _imagePath = reader.GetString(2);
                if (!reader.IsDBNull(3)) _body = reader.GetString(3);
                if (!reader.IsDBNull(4)) _accessID = reader.GetInt32(4);
                if (!reader.IsDBNull(5)) _viewOrder = reader.GetInt32(5);
                if (!reader.IsDBNull(6)) _creatorID = reader.GetInt32(6);
                if (!reader.IsDBNull(7)) _createdDate = reader.GetDateTime(7);
                if (!reader.IsDBNull(8)) _isPrivate = reader.GetBoolean(8);
                if (!reader.IsDBNull(9)) _lastUpated = reader.GetDateTime(9);
            }
        }

        #region Public Properties
        public int Id
        {
            get { return _id; }
        }

        public int ChapterID
        {
            get { return _chapterID; }
            set { _chapterID = value; }
        }

        public string ImagePath
        {
            get { return _imagePath; }
            set { _imagePath = value; }
        }

        public string Body
        {
            get { return _body; }
            set { _body = value; }
        }

        public int AccessID
        {
            get { return _accessID; }
            set { _accessID = value; }
        }

        public int ViewOrder
        {
            get { return _viewOrder; }
            set { _viewOrder = value; }
        }

        public int CreatorID
        {
            get { return _creatorID; }
            set { _creatorID = value; }
        }

        public DateTime CreatedDate
        {
            get { return _createdDate; }
            set { _createdDate = value; }
        }

        public bool IsPrivate
        {
            get { return _isPrivate; }
            set { _isPrivate = value; }
        }

        public DateTime LastUpated
        {
            get { return _lastUpated; }
            set { _lastUpated = value; }
        }
        #endregion

    }
    #endregion

}
